﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;

namespace OpenPhotoAlbum.Controls
{
	public static class StringUtility
	{
		public static string Format(string format, params object[] args)
		{
			return string.Format(CultureInfo.CurrentCulture, format, args);
		}

		public static string FormatAndHtmlEncode(string format, params object[] args)
		{
			return HttpUtility.HtmlEncode(Format(format, args));
		}

		public static string FormatWithInvariantCulture(string format, params object[] args)
		{
			return string.Format(CultureInfo.InvariantCulture, format, args);
		}

		public static string AddColon(string originalString)
		{
			return Format("{0}{1}", originalString, Resources.Strings.Colon);
		}

		public static string AddBrackets(string originalString)
		{
			return Format(Resources.Strings.Brackets, originalString);
		}

		public static string GetConfirmJs(string message)
		{
			return Format("javascript:return confirm('{0}');", HttpUtility.HtmlEncode(message));
		}

		public static string AddAppPrefix(string content)
		{
			return Format("{0} - {1}", AlbumPage.ApplicationName, content);
		}

		public static bool CompareIgnoreCase(string str1, string str2)
		{
			return str1.Equals(str2, StringComparison.InvariantCultureIgnoreCase);
		}
	}
}
